<div id="tabs">
	<ul>
        <li id="current"><?php echo $this->Html->link(__('Thời gian', true), array('controller' => 'kehoaches', 'action' => 'index',$donvi)); ?> </li>
        <li><?php if($madv[0] [0] ['ma'] == 'TT')  echo $this->Html->link(__('Chọn thời gian', true), array('controller'=>'kehoaches','action' => 'addtt',$donvi)); 
                    else echo $this->Html->link(__('Chọn thời gian', true), array('controller'=>'kehoaches','action' => 'addcn',$donvi));?></li>
	</ul>
</div>
<div class="kehoaches">
	<h2><?php __('Giao chỉ tiêu và kế hoạch tác nghiệp của '.$tendv[0] ['donvis'] ['tendv']);?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('STT');?></th>
			<th><?php echo $this->Paginator->sort('thoigian_id');?></th>
			<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
	$i = 0;$stt=0;
	foreach ($kehoaches as $kehoach):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $stt=$stt+1; ?>&nbsp;</td>
		<td>
			<?php echo $kehoach['Thoigian']['thoigian']; ?>
		</td>
       
        
		<td class="actions">
			<?php 
                if($madv[0] [0] ['ma'] == 'TT') { // neu la trung tam
                     If((date('d-m-Y',strtotime($kehoach['Thoigian']['ngaykt']))-date('d-m-Y',
                             strtotime($kehoach['Thoigian']['ngaybd'])))<8) {
                        echo $this->Html->link(__('Chỉ tiêu tuần', true), array('controller'=>'chitieunvs','action' => 'hienchitieu', $kehoach['Kehoach']['id']));
                        echo $this->Html->link(__('CV chỉ thị', true), array('controller'=>'nvchithis','action' => 'index', $kehoach['Kehoach']['id']));
                        echo $this->Html->link(__('Edit', true), array('action' => 'edit', $kehoach['Kehoach']['id'])); 
                        echo $this->Html->link(__('Delete', true), array('action' => 'delete', $kehoach['Kehoach']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $kehoach['Kehoach']['id']));  
                        } 
                        Else {
                                echo $this->Html->link(__('Chỉ tiêu tháng', true), array('controller'=>'chitieunvs','action' => 'hienchitieu', $kehoach['Kehoach']['id']));
                                echo $this->Html->link(__('Edit', true), array('action' => 'edit', $kehoach['Kehoach']['id'])); 
                                echo $this->Html->link(__('Delete', true), array('action' => 'delete', $kehoach['Kehoach']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $kehoach['Kehoach']['id']));  
                        }
                      if(in_array($kehoach['Kehoach']['id'],$dulieu))  
                              echo $this->Html->link(__('CV KH tuần', true), array('controller'=>'nvngays','action' => 'sua', $kehoach['Kehoach']['id']));
                      else
                              echo $this->Html->link(__('CV KH tuần', true), array('controller'=>'nvngays','action' => 'kq', $kehoach['Kehoach']['id']));
                      
                      echo $this->Html->link(__('Lũy kế', true), array('controller'=>'ztkluykes','action' => 'index', $kehoach['Kehoach']['id']));
			      
                } Else{ // neu la chi nhanh
                    echo $this->Html->link(__('Chỉ tiêu', true), array('controller'=>'chitieudvs','action' => 'hienchitieu', $kehoach['Kehoach']['id']));
			        echo $this->Html->link(__('Edit', true), array('action' => 'edit', $kehoach['Kehoach']['id'])); 
                    echo $this->Html->link(__('Delete', true), array('action' => 'delete', $kehoach['Kehoach']['id'],$donvi), null, sprintf(__('Are you sure you want to delete # %s?', true), $kehoach['Kehoach']['id']));
                    echo $this->Html->link(__('Lũy kế', true), array('controller'=>'ztkluykes','action' => 'index', $kehoach['Kehoach']['id']));
			                   
                }
                 echo $this->Html->link(__('Lũy kế', true), array('controller'=>'ztkluykes','action' => 'index', $kehoach['Kehoach']['id']));
			        
                ?>
                   
                    
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
